﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SysYcjy_zxdsystem : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["sTittle"] = "系统管理员调试专用页面";
            
        }
    }
    protected void cmdExec_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text != "c0d9k5j3q5z8h8a8")
        {
            Response.Write("<script language=javascript>alert('危险警告：您不是系统管理员，请不要操作该功能！！');if(opener!=null){opener.location.reload();window.close();}</script>");

            Response.Write(" <script> location.href='myaccount.aspx'; </script> ");
            return;
        }
        Conn zconn = new Conn();
        string zsql;
        int zresult;
        zsql = txtCmd.Text;
        zresult=zconn.ExeSql(zsql);
        zconn.Dispose();
        if (zresult == 0)
        {
            txtStatus.Text = "执行失败！";
        }
        else
        {
            txtStatus.Text = "执行成功！";
        }

    }
    protected void cmdResult_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text != "c0d9k5j3q5z8h8a8")
        {
            Response.Write("<script language=javascript>alert('危险警告：您不是系统管理员，请不要操作该功能！！');if(opener!=null){opener.location.reload();window.close();}</script>");

            Response.Write(" <script> location.href='myaccount.aspx'; </script> ");
            return;
        }
        Conn zconn = new Conn();
        string zsql;
        zsql = txtCmd.Text;
        
        DataSet myds2 = zconn.Conn_Send(zsql);
        zconn.Dispose();
        grdResult.DataSource = myds2;
        grdResult.DataBind();
        //------------------
       

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtCmd.Text = DropDownList1.SelectedValue;
    }

    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        if (TextBox1.Text == "c0d9k5j3q5z8h8a8")
        {
            DropDownList1.Visible = true;
            txtCmd.Visible = true;
        }
    }
}
